package com.apes.scm.masterdata.product.service;

import com.apes.framework.api.DomainService;
import com.apes.framework.plugin.esb.api.SimpleRequest;
import com.apes.scm.masterdata.product.model.CompanyProductUom;
import com.apes.scm.masterdata.product.repository.CompanyProductUomRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 功能：计量单位服务
 *
 * @author xul
 * @create 2018-03-08 11:14
 */
@Service("companyUomService")
public class CompanyProductUomService extends DomainService {

    @Autowired
    CompanyProductUomRepository companyUomRepository;

    public CompanyProductUom save(SimpleRequest request) {
        CompanyProductUom companyUom = request.getO(CompanyProductUom.class);
        companyUomRepository.saveAndFlush(companyUom);
        return companyUom;
    }

    /**
     * 功能：查询
     *
     * @param request
     */
    public List<CompanyProductUom> findAll(SimpleRequest request) {
        return companyUomRepository.findAll();
    }
}
